import java.util.Random;
import java.util.Scanner;

public class Test {
    public static void swap(int a,int b) {
        int tmp = a;
        a = b;
        b = tmp;
    }

    public static void main(String[] args) {
        int a =10;
        int b=20;
        System.out.println(a+ " " +b);
        swap(a,b);
        System.out.println(a+ " " +b);
    }
    public static boolean isLeanYear(int year) {
        if((year % 100!=0&&year % 4 ==0) || (year % 400 == 0)){
            //System.out.println(year+" 是闰年");
            return true;
        }
        return false;
    }
    public static int add(int a, int b) {
        return a+b;
        //System.out.println(a+b);
    }
    public static void main10(String[] args) {
        /*int ret = add(1,2);
        System.out.println(ret*2);

        boolean flg = isLeanYear(2024);
        System.out.println(flg);*/

        System.out.println(facSum(5));
    }
    public static int facSum(int n) {
        int sum = 0;
        for (int i = 1; i <= n ; i++) {
            sum += fac(i);
        }
        return sum;
    }
    public static int fac(int n) {
        int ret = 1;
        for (int j = 1; j <=n ; j++) {
            ret *= j;
        }
        return ret;
    }
    public static void main9(String[] args) {
        Scanner in =new Scanner(System.in);
        //注意 hasNext和 hasNextLine 的区别
        while (in.hasNextLine()){ //注意 while处理多个 case
            int n = in.nextInt();

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (i == j || i+j == n-1) {
                        System.out.print("*");
                    }else {
                        System.out.println(" ");
                    }
                }
                System.out.println();
            }

        }
    }
    public static void main8(String[] args) {
        Scanner scanner =new Scanner(System.in);

        while (scanner.hasNextInt()) {
            int age = scanner.nextInt();//10回车
            System.out.println( age);
        }
    }
    public static void main7(String[] args) {
        Scanner scanner =new Scanner(System.in);

        System.out.println("请输入你的年龄：");
        int age = scanner.nextInt();//10回车
        System.out.println("年龄："+ age);

        scanner.nextLine();

        System.out.println("请输入你的姓名：");//字符串
        String name =scanner.nextLine();//读取一行
        //String name =scanner.next();//遇到空格读取结束
        System.out.println("姓名："+ name);

        System.out.println("请输入你的体重：");
        float weight = scanner.nextFloat();
        System.out.println("体重为："+ weight);

        scanner.close();
    }
    public static void main6(String[] args) {
        System.out.println("输出数据并换行");
        System.out.print("输出数据但是不换行");
        System.out.printf("%s\n","hello");
    }
    public static void main5(String[] args) {
        Random random = new Random();
        int num = random.nextInt(100);//[0,100)

        Scanner scan =new Scanner(System.in);
        while (true) {
            System.out.println("请输入你的数字");
            int i = scan.nextInt();
            if (i > num) {
                System.out.println("猜大了");
            } else if (i == num) {
                System.out.println("猜对了!");
                break;
            }else {
                System.out.println("猜小了");
            }
        }
    }
    public static void main4(String[] args) {
        Random random = new Random();
        int num = random.nextInt(100);//[0,100)

        System.out.println(num);

        //从键盘输入
        Scanner scan =new Scanner(System.in);
        int i =scan .nextInt();

        System.out.println(i);
    }

    public static void main3(String[] args) {
        double sum = 0;
        int f = 1;
        for (int i = 1; i <= 100 ; i++) {
            sum = sum + 1.0/i*f;
            f = -f;
        }
        System.out.println(sum);
    }
    public static void main2(String[] args) {
        int a =12;
        int b =18;
        int c =a%b;//12
       while (c != 0) {
           a = b;//a = 18
           b = c;//12
           c = a % b;
       }
        System.out.println(b);
    }


    public static void main1(String[] args) {
        int count =0;
        for (int i = 1; i <= 100 ; i++) {
            if (i % 10 == 9) {
                count++;
            }else if (i / 10 == 9){
                count++;
            }
        }
        System.out.println(count);
    }

}
